<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="js/jquery-3.3.1.js"></script>
    <title>UserLogin</title>
    <style>
        textarea {
            width: 300px;
            height: 300px;
        }

        p {
            color: red;
        }

        #main_content{
            width: 800px;
            height: 500px;
            margin: 50px auto;
            border: 1px red solid;
            text-align: center;
        }
    </style>

    <script>
        $(document).ready(function () {
            $("#register_button").click(function () {
                var username = $("#username_input").val();
                var identityNumber = $("#identity_number_input").val();
                var password = $("#password_input").val();
                var verifyCode = $("#verify_code").val();
                console.log("username_input==" + username);
                console.log("identityNumber==" + identityNumber);
                console.log("password_input==" + password);
                console.log("verify_code==" + verifyCode);

                $.get("/entity_register", {
                    username: username,
                    identityNumber: identityNumber,
                    password: password,
                    verifyCode: verifyCode
                }, function (data, status) {
                    console.log("status==" + status);
                    if (status === "success") {
                        if (data.status === 0) {
                            // $("#main_content").load('user_control.html?address='+ data.data.address);
                            // $("#main_content").load('user_control.html?address=0x86423352d5fd727e0b727edb19cd2bcab7155e40');
                            if (window.localStorage) {
                                localStorage.name = data.data;
                                location.href = 'user_control.html';
                            }
                        } else {
                            $("#error_hint").text(data.message);
                        }
                    }
                })
            });
        });
    </script>
    <link rel="icon" href="images/hao.gif" type="image/x-icon">
</head>
<body>

<div id="main_content">
    姓名:<input type="text" id="username_input"/>
    <p id="error_hint"></p>
    <br/>
    身份证号:<input type="text" id="identity_number_input"/>
    <p></p>
    <br/>
    密码:<input type="text" id="password_input"/>
    <p></p>
    <br/>
    验证码:<input type="text" id="verify_code"/>
    <p></p>
    <br/>
    <button type="button" id="login_button">登录</button>
    <button type="button" id="register_button">注册</button>
</div>


</body>
</html>